package com.ruibang.glass.file.constant;

public enum FileErrorCode {

    UPLOAD_FILE_IS_FAILED(100050200, "文件上传失败"),
    FILE_IS_NOT_EXIST(100050201, "文件不存在,请检查"),
    IS_DIR_FILE_ID_NOT_NULL(100050202, "当文件类型为0时，文件ID不可为空！"),
    DELETE_ITEM_NO_EXIST(100050203, "目标文件已不存在，请刷新页面后重试！"),
    DIR_IS_EXIST(100050204, "文件夹已存在！");


    private int code;
    private String msg;

    FileErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }

    public static String getValue(int code) {
        for (FileErrorCode ele : values()) {
            if (ele.getCode() == code) return ele.getMsg();
        }
        return null;
    }

}
